<?php
/**
 *
 * User: zhaomeng1
 * Date: 2019/5/15
 * Time: 4:11 PM
 *
 */


    $redis = new Redis();

    $redis->connect("192.168.2.104",6379);

    $redis->auth('ADMINadmin');

    $redis_name='miaosha';


    for ($i = 0; $i<100; $i++) {
        $uid = rand (10000,99999);
        $num = 10;

        if ($redis->lLen ( $redis_name ) < 10) {
            $redis->rPush ( $redis_name, $uid . "%" . microtime () );
            echo "$uid 秒杀成功\n";

        } else {
            echo "秒杀结束\n";
        }


    }
